<template>
	<ArticleContainerMobile
	 v-model="currentChannel"
	 @change="getDetail"
	 :navbar="navbar">
		<div class="content">
			<span>{{ detail.info.content }}</span>
		</div>
	</ArticleContainerMobile>
</template>

<script setup lang="ts">
import { getNavList, getNewDetail } from '@/webApi/new'
import { useRoute } from 'vue-router'
const route = useRoute()
const navbar:Ref<any> = ref([])
const currentChannel:Ref<number> = ref(1)
getNavList({
	id:2
}).then(res => {
	navbar.value = res[0]
})
const detail = ref({
	name:'',
	info: {
		content:''
	}
})
// 获取详情
const getDetail = (id:number):void=>{
	currentChannel.value = id
	getNewDetail({ id }).then((data)=>{
		detail.value = data
		console.log(detail.value);
	})
}
onMounted(()=>{
	watch(()=>route.fullPath, _ => {
		getDetail(Number(route.query.id || 1))
	},{
		immediate: true
	})
})

</script>
<style lang="scss" scoped>
.in-content{
	display: grid;
	grid-template-rows: 0fr;
	padding: 10px;
	transition: all .3s;
}
</style>